package com.gao.alg.geek;

public class MoveZeros2 {


    /**
     * 双指针
     * @param nums
     */
    public void moveZeroes2(int[] nums) {
        int k = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] !=0){
                if (k != i){
                    nums[k] = nums[i];
                    nums[i] = 0;
                }
                k++;
            }
        }
    }
}
